package greedy;

import java.util.Arrays;
import java.util.Map;

/**
 * @ Author     ：侯耀祖
 * @ Description：
 */
public class findMinArrowShots {
    public int findMinArrowShots(int[][] points) {
        Arrays.sort(points, (a, b) -> Integer.compare(a[0], b[0]));
        int count = 1;
        for (int i = 1; i < points.length; i++) {
            int[] point = points[i];
            int[] pre = points[i-1];
            if (point[0] > pre[1]){
                count++;
            } else {
                point[1] = Math.min(pre[1], point[1]);
            }
        }
        return count;
    }
}
